<!--{template /module/admin/view/head}-->
<div id="left_layout">
	<div id="main_content" class="container-fluid">
		<!--{template /module/admin/view/head_nav}-->
		<div class="row-fluid">
			<form method="post" action="{$ADMIN_SCRIPT}/book/{$dispatches[method]}&id={$_var[gp_id]}&page={$_var[page]}&psize={$_var[psize]}{$search[querystring]}" onsubmit="javascript:return check_form(this);">
				<input type="hidden" name="formsubmit" value="yes" />
				<div class="well widget">
					<div class="widget-header">
						<p class="text">* {lang admin.validate.require}</p>
					</div>
					<div class="widget-content">
						<fieldset>
							<label>{lang book.index_edit.view.realname.label} *</label>
							<input type="text" class="input-medium"  name="txtRealName" placeholder="{lang book.index_edit.view.realname.placeholder}..." maxlength="20" value="{$book[REALNAME]}" />
							<span class="help-inline">{lang book.index_edit.view.realname.tips}</span>
							
							<label>{lang book.index_edit.view.connect.label} *</label>
							<input type="text" class="input-xlarge" name="txtConnect" placeholder="{lang book.index_edit.view.connect.placeholder}..." maxlength="50" value="{$book[CONNECT]}" />
							<span class="help-inline">{lang book.index_edit.view.connect.tips}</span>
							
							<label>{lang book.index_edit.view.email.label}</label>
							<input type="text" class="input-xlarge" name="txtEmail" placeholder="{lang book.index_edit.view.email.placeholder}..." maxlength="100" value="{$book[EMAIL]}" />
							<span class="help-inline">{lang book.index_edit.view.email.tips}</span>
							
							<label>{lang book.index_edit.view.department.label}</label>
							<input type="text" class="input-xlarge" name="txtDepartment" placeholder="{lang book.index_edit.view.department.placeholder}..." maxlength="50" value="{$book[DEPARTMENT]}" />
							<span class="help-inline">{lang book.index_edit.view.department.tips}</span>
							
							<label>{lang book.index_edit.view.place.label}</label>
							<input type="text" class="input-xlarge" name="txtPlace" placeholder="{lang book.index_edit.view.place.placeholder}..." maxlength="50" value="{$book[PLACE]}" />
							<span class="help-inline">{lang book.index_edit.view.place.tips}</span>
							
							<label>{lang book.index_edit.view.title.label} *</label>
							<input type="text" class="input-xxlarge"  name="txtTitle" placeholder="{lang book.index_edit.view.title.placeholder}..."  maxlength="50"  value="{$book[TITLE]}" />
							<span class="help-inline">{lang book.index_edit.view.title.tips}</span>
							
							<label>{lang book.index_edit.view.remark.label}</label>
							<textarea class="span8" rows="3" cols="45" name="txtRemark" placeholder="{lang book.index_edit.view.remark.placeholder}...">{$book[REMARK]}</textarea>
							<br/>
							<span class="help-inline">{lang book.index_edit.view.remark.tips}</span>
							
							<hr/>
							<label>{lang book.index_edit.view.reply.label}</label>
							<textarea class="span8" rows="2" cols="45" name="txtReply" placeholder="{lang book.index_edit.view.reply.placeholder}...">{$book[REPLY]}</textarea>
							<br/>
							<span class="help-inline">{lang book.index_edit.view.reply.tips}</span>
					   </fieldset>
					   
					   <hr/>
					   
					   <fieldset>
							<!--{if $dispatches['method'] == '_pub'}-->
							<button type="submit" class="btn btn-small btn-primary" {$dispatches[operations][add]}>{lang admin.operation.submit}</button>
							<!--{else}-->
							<button type="submit" class="btn btn-small btn-primary" {$dispatches[operations][edit]}>{lang admin.operation.submit}</button>
							<!--{/if}-->
							
							<button type="reset" class="btn btn-small">{lang admin.operation.reset}</button>
							<button type="button" class="btn btn-small" onclick="javascript:location.href='{$ADMIN_SCRIPT}/book&page={$_var[page]}&psize={$_var[psize]}{$search[querystring]}';">{lang admin.operation.go.back}</button>
						</fieldset>		            
					</div>
				</div>	
			</form>
		</div>
	</div>
</div> 

<script>
function check_form(frm){
	if(frm.txtRealName.value.trim().length == 0){
    	$(frm.txtRealName).next('.help-inline').css('color', 'red');
    	frm.txtRealName.focus();
    	return false;
    }
    
    if(frm.txtConnect.value.trim().length == 0){
    	$(frm.txtConnect).next('.help-inline').css('color', 'red');
    	frm.txtConnect.focus();
    	return false;
    }
    
    if(frm.txtTitle.value.trim().length == 0){
    	$(frm.txtTitle).next('.help-inline').css('color', 'red');
    	frm.txtTitle.focus();
    	return false;
    }
    
    return true;
}
    
$(function(){
	$('fieldset input,textarea,select').blur(function(){
		$(this).next('.help-inline').css('color', '#333');
	});
});
</script>
<!--{template /module/admin/view/foot}-->